using Godot;
using System;

public partial class EnemyReturnState : EnemyState
{
    
    public override void _Ready()
    {
        base._Ready();
        destination = GetPointGlobalPostion(0);
    }
    protected override void EnterState()
    {
        characterNode.AnimPlayerNode.Play(GameConstants.ANIM_MOVE);
        characterNode.AgenNode.TargetPosition = destination;
        characterNode.ChaseAreaNode.BodyEntered += HandleChaseAreaBodyEntered;

    }

    protected override void ExitState()
    {
        characterNode.ChaseAreaNode.BodyEntered -= HandleChaseAreaBodyEntered;
    }
    public override void _PhysicsProcess(double delta)
    {
        if(characterNode.AgenNode.IsNavigationFinished())
        {
            GD.Print("trash to parl");
            characterNode.StateMachineNode.SwitchState<EnemyPatrolState>();
            return;
        }
        
        Move();

    }
}
